<style>
.CodeMirror{height:100%;font-size:14px;}
</style>
<script>
function refreshTaskTemplate(){
	$('textarea[name=content]',navTab.getCurrentPanel()).val(taskTemplateEditor.getValue());
}
</script>
<h2 class="contentTitle">
 		<a href="taskTemplate/chipLookup.html" target="dialog" mask="true">模板片段</a>
	<#if !path?has_content||!path?starts_with('/ftl/')>
		<a href="taskTemplate/content.html?path=${'/ftl/'?url}" target="ajax" rel="taskTemplateBox">创建模板片段</a>
	</#if>
	<a href="taskTemplate/delete.do?path=${path?html?url}&navTabId=taskTemplate/list" title="确定要删除该模板吗?" target="ajaxTodo">删除模板</a>
</h2>
<div class="pageContent">
	<form method="post" action="taskTemplate/save.do?navTabId=taskTemplate/list" class="pageForm required-validate" onsubmit="refreshTaskTemplate();return validateCallback(this, navTabAjaxDone);">
		<div style="height: 24px;padding: 0 5px;">
			<label>路径:</label><input name="path" class="required" type="text" maxlength="50" size="50" value="${(path?html)!}"/>
		</div>
		<div class="pageFormContent" layoutH="122" style="background:#ffffff;">
	   		<div> 
				<textarea name="content" id="taskTemplateEditor"><@_taskTemplateContent path=path>${(object?html)!}</@_taskTemplateContent></textarea>
				<script>
					var taskTemplateEditor = CodeMirror.fromTextArea(document.getElementById('taskTemplateEditor'), {
				        mode: "freemarkermixed",
				        lineNumbers: true,
				        tabSize        : 4,
				        indentUnit     : 4,
				        indentWithTabs : true
					});
				</script>
			</div>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
</div>